package com.google.code.sharecontent.model;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

public class ContentDisplay extends BaseDisplay {

	private Content content;

	private Boolean select;
	private Boolean selectPrevValue;
	private String filename;

	
	public static ContentDisplay createContentDisplay(Content content) {
		ContentDisplay contentDisplay = new ContentDisplay();
		contentDisplay.content = content;
		try {
			contentDisplay.setFilename(URLDecoder.decode(content.getFilename(),"UTF-8"));
		} catch (UnsupportedEncodingException e) {
			contentDisplay.setFilename(content.getFilename());
		}
		return contentDisplay;
	}
	
	public Integer getId() {
		return content.getId();
	}
	
	public Boolean getSelect() {
		if (select == null) {
			select = Boolean.FALSE;
		}
		return select;
	}

	public void setSelect(Boolean select) {
		this.select = select;
	}

	/*public ContentDisplay(Content content) {
		this.content = content;
	}*/
	
	public String getTitle() {
		return content.getTitle();
	}
	
	public String getUrl() {
		return content.getUrl();
	}
	
	public String getFilename() {
		return filename;
	}
	
	public void setFilename(String filename) {
		this.filename = filename;
	}

	public Content getContent() {
		return content;
	}
	
	public String getArtist() {
		return content.getArtist();
	}
	
	public String getAlbum() {
		return content.getAlbum();
	}
	
	public String getYear() {
		return content.getYear();
	}

	public void setSelectPrevValue(Boolean selectPrevValue) {
		this.selectPrevValue = selectPrevValue;
	}

	public Boolean getSelectPrevValue() {
		if (selectPrevValue == null) {
			selectPrevValue = Boolean.FALSE;
		}
		return selectPrevValue;
	}
}
